package com.qdy.entity.exercise;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

import com.jiai.core.configurer.DateFormat;
import com.jiai.core.util.DateJsonSerializer;
import com.qdy.entity.Entitys;
import com.qdy.entity.user.User;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 *  活动
 */
@Entity
@Table(name = "t_exercise")
public class Exercise extends Entitys implements Serializable {
	private static final long serialVersionUID = 1L;
		 @Id
		 @GeneratedValue
		 private Long  id ;
		 /**
		 	
		 **/
		 @ManyToOne(cascade = { CascadeType.REFRESH, CascadeType.MERGE }, optional = false)
		 @JoinColumn(name = "user_id")
		 private User user ;
		 /**
		 	活动标题
		 **/
		 @Column(nullable = false,length = 20)
		 private String  title ;

		 private String imgs;
		 /**
		 	活动描诉
		 **/
		 @Column(length = 200)
		 private String  depict ;
		 /**
		 	活动地址
		 **/
		 private String address;
		 private String  geohash ;

		/**
		 * 报名人群  0所有的 1个人 2 团队
		 */
		private Integer enrollType=1;

		/**
		 * 报名费用
		 */
		private Integer entryFee;
		/**
		 * 报名人数
		 */
		private Integer enrollNum;
		/**
		 * 标签组
		 */
		@Column(nullable = false)
		private  String labes;
		/**
		 * 结束时间
		 */

		@JSONField(format = "yyyy-MM-dd")
		@DateTimeFormat(pattern = "yyy-MM-dd")
		private Date endTime;

		/**
		 * 开如时间
		 */


		@JSONField(format = "yyyy-MM-dd")
		@DateTimeFormat(pattern = "yyy-MM-dd")
		private Date startTime;


		/**
		 * 浏览人数
		 */
		@Column(columnDefinition = "INT default 0")
		private Long browseNumber;
		/**
		 * 分享人数
		 */
		@Column(columnDefinition = "INT default 0")
		private Long shareNumber;


		/**
			创建时间
		 **/
		 @Column(updatable = false)
		 private Date  createTime=new Date();


		public Long getId() {
			return id;
		}

		public void setId(Long id) {
			this.id = id;
		}

		public User getUser() {
			return user;
		}

		public void setUser(User user) {
			this.user = user;
		}

		public String getTitle() {
			return title;
		}

		public void setTitle(String title) {
			this.title = title;
		}

		public String getDepict() {
			return depict;
		}

		public void setDepict(String depict) {
			this.depict = depict;
		}

		public String getAddress() {
			return address;
		}

		public void setAddress(String address) {
			this.address = address;
		}

		public String getGeohash() {
			return geohash;
		}

		public void setGeohash(String geohash) {
			this.geohash = geohash;
		}

		public Integer getEnrollType() {
			return enrollType;
		}

		public void setEnrollType(Integer enrollType) {
			this.enrollType = enrollType;
		}

		public Integer getEntryFee() {
			return entryFee;
		}

		public void setEntryFee(Integer entryFee) {
			this.entryFee = entryFee;
		}

		public Integer getEnrollNum() {
			return enrollNum;
		}

		public void setEnrollNum(Integer enrollNum) {
			this.enrollNum = enrollNum;
		}

		public String getLabes() {
			return labes;
		}

		public void setLabes(String labes) {
			this.labes = labes;
		}

		public Date getEndTime() {
			return endTime;
		}

		public void setEndTime(Date endTime) {
			this.endTime = endTime;
		}

		public Date getStartTime() {
			return startTime;
		}

		public void setStartTime(Date startTime) {
			this.startTime = startTime;
		}

	public Long getBrowseNumber() {
		return browseNumber;
	}

	public void setBrowseNumber(Long browseNumber) {
		this.browseNumber = browseNumber;
	}

	public Long getShareNumber() {
		return shareNumber;
	}

	public void setShareNumber(Long shareNumber) {
		this.shareNumber = shareNumber;
	}

	public Date getCreateTime() {
			return createTime;
		}

		public void setCreateTime(Date createTime) {
			this.createTime = createTime;
		}

	public String getImgs() {
		return imgs;
	}

	public void setImgs(String imgs) {
		this.imgs = imgs;
	}
}